import type { PostPatientConsultOrderParams } from '@/types/consult'
import { defineStore } from 'pinia'
import { ref } from 'vue'

// 通过类型别名，保存问诊信息类型，方便复用
export type IllnessInfoType = Pick<
  PostPatientConsultOrderParams,
  'illnessDesc' | 'illnessTime' | 'consultFlag' | 'pictures'
>
// 问诊信息
export const useConsultStore = defineStore(
  'consult',
  () => {
     // 初始化数据
     const initValue: IllnessInfoType = {
      illnessDesc: '',
      illnessTime: 1,
      consultFlag: 0,
      pictures: [],
    }
     // 病情描述
     const illnessInfo = ref<IllnessInfoType>({ ...initValue })
    // 极速问诊
    const type=ref('')
    // 问诊类型
    const illnessType=ref('')
    //科室ID
    const depId=ref('')
    // 患者ID
    const patientId=ref('')
     // 重置store数据
    const reset=()=>{
      illnessInfo.value={...initValue}
      type.value=''
      illnessType.value=''
      depId.value=''
      patientId.value=''
    }
    return { illnessInfo,type,illnessType,depId,patientId,reset }
  },
  {
    // 持久化
    persist: true,
  }
)